hotplug/FreeBSD: add block hotplug script
authorRoger Pau Monne <roger.pau@citrix.com>
Thu, 31 Mar 2016 12:56:36 +0000 (14:56 +0200)
committerIan Jackson <Ian.Jackson@eu.citrix.com>
Wed, 6 Apr 2016 14:50:45 +0000 (15:50 +0100)
This is the default hotplug script for block devices. Its only job is to
copy the "params" blkback xenstore node to "physical-device".

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
tools/hotplug/FreeBSD/Makefile
tools/hotplug/FreeBSD/block [new file with mode: 0644]

index 10fce4fb7abf7d9217859687ce2e153a416594ba..bd7a86fa07db650e2bac124b74cdae5e4119bcef 100644 (file)
@@ -2,7 +2,7 @@ XEN_ROOT = $(CURDIR)/../../..
 include $(XEN_ROOT)/tools/Rules.mk
 
 # Xen script dir and scripts to go there.
-XEN_SCRIPTS = vif-bridge
+XEN_SCRIPTS = vif-bridge block
 
 XEN_SCRIPT_DATA =
 
diff --git a/tools/hotplug/FreeBSD/block b/tools/hotplug/FreeBSD/block
new file mode 100644 (file)
index 0000000..a31cca4
--- /dev/null
@@ -0,0 +1,25 @@
+#!/bin/sh -e
+#
+# FreeBSD hotplug script for attaching disks
+#
+# Parameters:
+#      $1: xenstore backend path of the vbd
+#      $2: action, either "add" or "remove"
+#
+# Environment variables:
+#      None
+#
+
+path=$1
+action=$2
+params=$(xenstore-read "$path/params")
+
+case $action in
+add)
+       xenstore-write $path/physical-device-path $params
+       exit 0
+       ;;
+*)
+       exit 0
+       ;;
+esac